package com.zjdiepu.www.proxy.biz.impl.own;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.diepu.www.client.proxy.hzicbc.request.CreditResultRequest;
import com.diepu.www.client.proxy.hzicbc.request.ObtainFileListRequest;
import com.diepu.www.client.proxy.partner.common.ObtainFileListResponse;
import com.zjdiepu.www.base.core.BaseException;
import com.zjdiepu.www.base.enums.type.ResultFlagType;
import com.zjdiepu.www.diepu.enums.ModeIDTypeDiepu;
import com.zjdiepu.www.diepu.enums.TransferStatusDiepu;
import com.zjdiepu.www.enums.StatusAttachments;
import com.zjdiepu.www.enums.TransferAttachStatus;
import com.zjdiepu.www.enums.TransferHandleStatus;
import com.zjdiepu.www.enums.TransferModeID;
import com.zjdiepu.www.proxy.biz.impl.BaseProxyService;
import com.zjdiepu.www.proxy.biz.own.HzBiz;
import com.zjdiepu.www.proxy.biz.own.HzGhBiz;
import com.zjdiepu.www.proxy.biz.own.LogsBiz;
import com.zjdiepu.www.proxy.biz.transfer.INewTransaction;
import com.zjdiepu.www.proxy.dao.own.HzDao;
import com.zjdiepu.www.proxy.dao.transfer.TransferOtherAttachmentsMapper;
import com.zjdiepu.www.proxy.dao.transfer.TransferOtherTimedTaskMapper;
import com.zjdiepu.www.proxy.dao.transfer.TransferYwOrdernoBankMapper;
import com.zjdiepu.www.proxy.dao.transfer.TransferZxCreditQueryMapper;
import com.zjdiepu.www.proxy.dao.transfer.TransferZxQueryCreditApplyMapper;
import com.zjdiepu.www.proxy.dao.transfer.TransferZxQueryCreditApplySubMapper;
import com.zjdiepu.www.proxy.model.dto.own.SysUserProxy;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferLogs;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferLogsSub;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferOtherAttachments;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferYwOrdernoBank;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferZxCreditQuery;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferZxQueryCreditApply;
import com.zjdiepu.www.proxy.model.dto.transfer.TransferZxQueryCreditApplySub;
import com.zjdiepu.www.proxy.model.ext.transfer.TransferZxCreditQueryExt;
import com.zjdiepu.www.proxy.model.ext.transfer.TransferZxQueryCreditApplyExt;
import com.zjdiepu.www.service.partner.IcbcApiService;
import com.zjdiepu.www.util.MinuteTaskUtil;

@Service
public class HzGhBizImpl extends BaseProxyService implements HzGhBiz
{
	
	@Autowired
	private HzDao hzDao;
	
	@Autowired
	private HzBiz hzBiz;
	
	@Autowired
	private LogsBiz logsBiz;
	
	@Resource
	private IcbcApiService icbcApiService;
	@Resource
	private INewTransaction newTransaction;
	
	@Autowired
	private TransferZxQueryCreditApplyMapper rransferZxQueryCreditApplyMapper;
	
	@Autowired
	private TransferZxQueryCreditApplySubMapper transferZxQueryCreditApplySubMapper;
	
	@Autowired
	private TransferZxCreditQueryMapper transferZxCreditQueryMapper;
	
	@Autowired
	private TransferYwOrdernoBankMapper transferYwOrdernoBankMapper;
	
	@Autowired
	private TransferOtherTimedTaskMapper transferOtherTimedTaskMapper;
	
	@Autowired
	private TransferOtherAttachmentsMapper transferOtherAttachmentsMapper;
	


	@Override
	public int diepuZxCopyApply(SysUserProxy sysUserProxy,TransferZxQueryCreditApply transferZxQueryCreditApply,List<TransferZxQueryCreditApplySub> transferZxQueryCreditApplySub,List<TransferZxCreditQuery> transferCreditQuerys,TransferYwOrdernoBank transferYwOrdernoBank) 
	{
		
		String userId = sysUserProxy.getUserId();
		String loginName = sysUserProxy.getLoginName();
		Integer millis = (int) (System.currentTimeMillis() / 1000);
		
		if(StringUtils.isBlank(userId) || StringUtils.isBlank(loginName))
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBankOrderNo(transferZxQueryCreditApply.getBankOrderNo());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
			transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
			transferLogs.setDescribeEvent(ResultFlagType.LOGIN_TIMEOUT.getValue());
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError(ResultFlagType.LOGIN_TIMEOUT.getValue());
			throw new BaseException(ResultFlagType.LOGIN_TIMEOUT.getCode().toString(),ResultFlagType.LOGIN_TIMEOUT.getValue());
		}
		
		if(null == transferZxQueryCreditApply)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
			transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
			transferLogs.setDescribeEvent("transferZxQueryCreditApply is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferZxQueryCreditApply is null");
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"transferZxQueryCreditApply is null");
		}
		
		if(null == transferZxQueryCreditApplySub || transferZxQueryCreditApplySub.size() == 0)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBankOrderNo(transferZxQueryCreditApply.getBankOrderNo());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
			transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
			transferLogs.setDescribeEvent("transferZxQueryCreditApplySub is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferZxQueryCreditApplySub is null");
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"transferZxQueryCreditApplySub is null");
		}
		
		if(StringUtils.isBlank(transferZxQueryCreditApply.getId()))
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBankOrderNo(transferZxQueryCreditApply.getBankOrderNo());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
			transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
			transferLogs.setDescribeEvent("transferZxQueryCreditApply_ID is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferZxQueryCreditApply_ID is null");
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"transferZxQueryCreditApply_ID is null");
		}
		
		if(null == transferCreditQuerys || transferCreditQuerys.size() == 0)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBankOrderNo(transferZxQueryCreditApply.getBankOrderNo());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
			transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
			transferLogs.setDescribeEvent("transferCreditQueryHzicbcs is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferCreditQueryHzicbcs is null");
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"transferCreditQueryHzicbcs is null");
		}
		
		if(null == transferYwOrdernoBank)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBankOrderNo(transferZxQueryCreditApply.getBankOrderNo());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setDataId(transferZxQueryCreditApply.getId());
			transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
			transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
			transferLogs.setDescribeEvent("transferYwOrdernoBank is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferYwOrdernoBank is null");
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"transferYwOrdernoBank is null");
		}
		
		//银行订单号
		String bankOrderNo = "";
		
		//查询是否重复
		TransferZxQueryCreditApply zxQueryCreditApply = rransferZxQueryCreditApplyMapper.selectByPrimaryKey(transferZxQueryCreditApply.getId());
		if(null == zxQueryCreditApply)
		{
			bankOrderNo = transferZxQueryCreditApply.getBankOrderNo();
			transferZxQueryCreditApply.setCreator(userId);
			transferZxQueryCreditApply.setCreatorName(loginName);
			transferZxQueryCreditApply.setCreated(millis);
			int count = rransferZxQueryCreditApplyMapper.insert(transferZxQueryCreditApply);
			if(count < 1)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(transferZxQueryCreditApply.getBankOrderNo());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("rransferZxQueryCreditApplyMapper insert error");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("rransferZxQueryCreditApplyMapper insert error");
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"rransferZxQueryCreditApplyMapper insert error");
			}
		}
		
		if(null != zxQueryCreditApply)
		{
			bankOrderNo = zxQueryCreditApply.getBankOrderNo();
			transferZxQueryCreditApply.setModifier(userId);
			transferZxQueryCreditApply.setModifierName(loginName);
			transferZxQueryCreditApply.setModified(millis);
			transferZxQueryCreditApply.setBankOrderNo(bankOrderNo);
			int count = rransferZxQueryCreditApplyMapper.updateByPrimaryKey(transferZxQueryCreditApply);
			if(count < 1)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("rransferZxQueryCreditApplyMapper updateByPrimaryKey error");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("rransferZxQueryCreditApplyMapper updateByPrimaryKey error");
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"rransferZxQueryCreditApplyMapper updateByPrimaryKey error");
			}
		}
		
		for(int i=0;i<transferZxQueryCreditApplySub.size();i++)
		{
			TransferZxQueryCreditApplySub listApplySub = transferZxQueryCreditApplySub.get(i);
			if(null == listApplySub)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("listApplySub is null");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("listApplySub is null");
				throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"listApplySub is null");
			}
			
			if(StringUtils.isBlank(listApplySub.getId()))
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("listApplySub_ID is null");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("listApplySub_ID is null");
				throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"listApplySub_ID is null");
			}
			
			//查询是否重复
			TransferZxQueryCreditApplySub zxQueryCreditApplySub = transferZxQueryCreditApplySubMapper.selectByPrimaryKey(listApplySub.getId());
			if(null == zxQueryCreditApplySub)
			{
				listApplySub.setBankOrderNo(bankOrderNo);
				listApplySub.setCreator(userId);
				listApplySub.setCreatorName(loginName);
				listApplySub.setCreated(millis);
				int count = transferZxQueryCreditApplySubMapper.insert(listApplySub);
				if(count < 1)
				{
					TransferLogs transferLogs = new TransferLogs();
					transferLogs.setBankOrderNo(bankOrderNo);
					transferLogs.setDataId(transferZxQueryCreditApply.getId());
					transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
					transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
					transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
					transferLogs.setDescribeEvent("transferZxQueryCreditApplySubMapper insert error");
					logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
					hzBiz.loggerError("transferZxQueryCreditApplySubMapper insert error");
					throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferZxQueryCreditApplySubMapper insert error");
				}
			}
			
			if(null != zxQueryCreditApplySub)
			{
				listApplySub.setBankOrderNo(bankOrderNo);
				listApplySub.setModifier(userId);
				listApplySub.setModifierName(loginName);
				listApplySub.setModified(millis);
				int count = transferZxQueryCreditApplySubMapper.updateByPrimaryKey(listApplySub);
				if(count < 1)
				{
					TransferLogs transferLogs = new TransferLogs();
					transferLogs.setBankOrderNo(bankOrderNo);
					transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
					transferLogs.setDataId(transferZxQueryCreditApply.getId());
					transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
					transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
					transferLogs.setDescribeEvent("transferZxQueryCreditApplySubMapper updateByPrimaryKey error");
					logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
					hzBiz.loggerError("transferZxQueryCreditApplySubMapper updateByPrimaryKey error");
					throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferZxQueryCreditApplySubMapper updateByPrimaryKey error");
				}
			}
		}
		
		for(int i=0;i<transferCreditQuerys.size();i++)
		{
			TransferZxCreditQuery creditQueryHzicbc = transferCreditQuerys.get(i);
			if(null == creditQueryHzicbc)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("creditQueryHzicbc is null");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("creditQueryHzicbc is null");
				throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"creditQueryHzicbc is null");
			}
			if(StringUtils.isBlank(creditQueryHzicbc.getId()))
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("creditQueryHzicbc_ID is null");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("creditQueryHzicbc_ID is null");
				throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"creditQueryHzicbc_ID is null");
			}
			
			TransferZxCreditQuery transferCreditQueryHzicbc = transferZxCreditQueryMapper.selectByPrimaryKey(creditQueryHzicbc.getId());
			if(null == transferCreditQueryHzicbc)
			{
				creditQueryHzicbc.setCreator(userId);
				creditQueryHzicbc.setCreatorName(loginName);
				creditQueryHzicbc.setCreated(millis);
				int count = transferZxCreditQueryMapper.insert(creditQueryHzicbc);
				if(count < 1)
				{
					TransferLogs transferLogs = new TransferLogs();
					transferLogs.setBankOrderNo(bankOrderNo);
					transferLogs.setDataId(transferZxQueryCreditApply.getId());
					transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
					transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
					transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
					transferLogs.setDescribeEvent("transferCreditQueryHzicbcMapper insert error");
					logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
					hzBiz.loggerError("transferCreditQueryHzicbcMapper insert error");
					throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferCreditQueryHzicbcMapper insert error");
				}
			}
			
			if(null != transferCreditQueryHzicbc)
			{
				creditQueryHzicbc.setModifier(userId);
				creditQueryHzicbc.setModifierName(loginName);
				creditQueryHzicbc.setModified(millis);
				int count = transferZxCreditQueryMapper.updateByPrimaryKey(creditQueryHzicbc);
				if(count < 1)
				{
					TransferLogs transferLogs = new TransferLogs();
					transferLogs.setBankOrderNo(bankOrderNo);
					transferLogs.setDataId(transferZxQueryCreditApply.getId());
					transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
					transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
					transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
					transferLogs.setDescribeEvent("transferCreditQueryHzicbcMapper updateByPrimaryKey error");
					logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
					hzBiz.loggerError("transferCreditQueryHzicbcMapper updateByPrimaryKey error");
					throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferCreditQueryHzicbcMapper updateByPrimaryKey error");
				}
			}
		}
		
		TransferYwOrdernoBank ywOrdernoBank = new TransferYwOrdernoBank();
		ywOrdernoBank.setOrdeRno(bankOrderNo);
		ywOrdernoBank.setDpStatus(1);
		ywOrdernoBank.setTypeData(3);
		ywOrdernoBank.setOrderSql("`CREATED` DESC");
		ywOrdernoBank = transferYwOrdernoBankMapper.selectRefined(ywOrdernoBank);
		if(null == ywOrdernoBank)
		{
			transferYwOrdernoBank.initInsertData(userId, loginName);
			transferYwOrdernoBank.setTypeData(3);
			int count = transferYwOrdernoBankMapper.insert(transferYwOrdernoBank);
			if(count < 1)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("transferYwOrdernoBankMapper insert error");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("transferYwOrdernoBankMapper insert error");
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferYwOrdernoBankMapper insert error");
			}
		}
		
		if(null != ywOrdernoBank)
		{
			transferYwOrdernoBank.setId(ywOrdernoBank.getId());
			int count = transferYwOrdernoBankMapper.updateByPrimaryKeySelective(transferYwOrdernoBank);
			if(count < 1)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBankOrderNo(bankOrderNo);
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setDataId(transferZxQueryCreditApply.getId());
				transferLogs.setTransferModeId(TransferModeID.SQCZX.getCode());
				transferLogs.setTransferModeName(TransferModeID.SQCZX.getValue());
				transferLogs.setDescribeEvent("transferYwOrdernoBankMapper updateByPrimaryKeySelective error");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("transferYwOrdernoBankMapper updateByPrimaryKeySelective error");
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferYwOrdernoBankMapper updateByPrimaryKeySelective error");
			}
		}
		
		//写一个时间为2分钟（可配）只有的 从主程序获取附件列表 的定时任务
		newTransaction.saveHqfjlbTaskWith2Minutes(bankOrderNo, transferZxQueryCreditApply.getId(),MinuteTaskUtil.diepu2MinuteTask);
		//写一个时间为5分钟（可配）之后的下载附件定时任务
		newTransaction.xzfjTaskWith5Minutes(bankOrderNo, transferZxQueryCreditApply.getId(),MinuteTaskUtil.diepu5MinuteTask);
		//写一个时间为10分钟（可配）之后的向工行申请查征信定时任务
		newTransaction.sqczxTaskWith10Minute(bankOrderNo, transferZxQueryCreditApply.getId(),MinuteTaskUtil.diepu10MinuteTask);
		return 1;
	}


	@Override
	public int diepuZxFeedbackHandle(SysUserProxy sysUserProxy,String result,String orderno,CreditResultRequest creditResultRequest) 
	{
		
		String userId = sysUserProxy.getUserId();
		String loginName = sysUserProxy.getLoginName();
		Integer millis = (int) (System.currentTimeMillis() / 1000);
		String relation = creditResultRequest.getReq().getRelation();
		if(StringUtils.isBlank(relation))
		{
			return 0;
		}
		
		String creditPeopleType = "";
		
		if(relation.equals("本人"))
		{
			creditPeopleType = "03";
		}
		else if(relation.equals("配偶"))
		{
			creditPeopleType = "01";
		}
		else if(relation.equals("反担保"))
		{
			creditPeopleType = "02";
		}
		String dataId = "";
		String sqlXmls = "select sub.id subId,sub.query_credit_apply_id appId,q.id qId from transfer_zx_query_credit_apply_sub sub inner join transfer_zx_credit_query q where sub.dp_status = 1 and sub.credit_people_type = '"+creditPeopleType+"' and sub.type_data = 3 and sub.bank_order_no = '"+orderno+"' limit 1";
		Map<String, String> maps = hzDao.selectMapsSql(sqlXmls);
		if(null != maps && !maps.isEmpty())
		{
			//当前时间
			Date startDate = new Date();
			//工行返回备注
			String note = creditResultRequest.getReq().getNote();
			
			TransferZxCreditQuery transferCreditQueryHzicbc = new TransferZxCreditQuery();
			transferCreditQueryHzicbc.setId(maps.get("qId"));
			
			
			//如果工行返回的result（客户信用等级） 为 001或者002 或者 003
			if(result.equals("001") || result.equals("002") || result.equals("003"))
			{
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getLeftAmount()) && !creditResultRequest.getReq().getLeftAmount().equals("-"))
				{
					transferCreditQueryHzicbc.setLeftAmount(Double.valueOf(creditResultRequest.getReq().getLeftAmount()));
				}
				
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getLeftNum()) && !creditResultRequest.getReq().getLeftNum().equals("-"))
				{
					transferCreditQueryHzicbc.setLeftNum(Integer.valueOf(creditResultRequest.getReq().getLeftNum()));
				}
				
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getLoanCrdt()) && !creditResultRequest.getReq().getLoanCrdt().equals("-"))
				{
					transferCreditQueryHzicbc.setLoanCrdt(creditResultRequest.getReq().getLoanCrdt());
				}
				
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getCardCrdt()) && !creditResultRequest.getReq().getCardCrdt().equals("-"))
				{
					transferCreditQueryHzicbc.setCardCrdt(creditResultRequest.getReq().getCardCrdt());
				}
				
				transferCreditQueryHzicbc.setTransferHandleStatus(Integer.valueOf(TransferStatusDiepu.FHCG.getCode()));
				transferCreditQueryHzicbc.setOperatorId(userId);
				transferCreditQueryHzicbc.setOperatorName(loginName);
				transferCreditQueryHzicbc.setOperatorDate(startDate);
				transferCreditQueryHzicbc.setStartDate(startDate);
				transferCreditQueryHzicbc.setRemarks(note);
				Date date = new Date();
				Calendar calendar = new GregorianCalendar();
				calendar.setTime(date); 
				calendar.add(Calendar.DAY_OF_MONTH, 30);
				date = calendar.getTime();  
				transferCreditQueryHzicbc.setStartDate(startDate);
				transferCreditQueryHzicbc.setEndDate(date);
				
				if(result.equals("001"))
				{
					transferCreditQueryHzicbc.setCreditResult("01");
				}
				else if(result.equals("002"))
				{
					transferCreditQueryHzicbc.setCreditResult("02");
				}
				else if(result.equals("003"))
				{
					transferCreditQueryHzicbc.setCreditResult("03");
				}
				
				transferCreditQueryHzicbc.setCreditQueryStatus(40);
//				transferCreditQueryHzicbc.setCreditResultMark("<p>"+note+"</p>");
//				@update 2018-02-02 查询结果说明 删除<p>便于解析
				transferCreditQueryHzicbc.setCreditResultMark(note);
				transferCreditQueryHzicbc.setOnceCarStatus("-");
			}
			else if(result.equals("099"))
			{
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getLeftAmount()) && !creditResultRequest.getReq().getLeftAmount().equals("-"))
				{
					transferCreditQueryHzicbc.setLeftAmount(Double.valueOf(creditResultRequest.getReq().getLeftAmount()));
				}
				
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getLeftNum()) && !creditResultRequest.getReq().getLeftNum().equals("-"))
				{
					transferCreditQueryHzicbc.setLeftNum(Integer.valueOf(creditResultRequest.getReq().getLeftNum()));
				}
				
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getLoanCrdt()) && !creditResultRequest.getReq().getLoanCrdt().equals("-"))
				{
					transferCreditQueryHzicbc.setLoanCrdt(creditResultRequest.getReq().getLoanCrdt());
				}
				
				if(StringUtils.isNotBlank(creditResultRequest.getReq().getCardCrdt()) && !creditResultRequest.getReq().getCardCrdt().equals("-"))
				{
					transferCreditQueryHzicbc.setCardCrdt(creditResultRequest.getReq().getCardCrdt());
				}
				
				transferCreditQueryHzicbc.setTransferHandleStatus(Integer.valueOf(TransferStatusDiepu.FHCG.getCode()));
				transferCreditQueryHzicbc.setOperatorId(userId);
				transferCreditQueryHzicbc.setOperatorName(loginName);
				transferCreditQueryHzicbc.setOperatorDate(startDate);
				transferCreditQueryHzicbc.setStartDate(startDate);
				transferCreditQueryHzicbc.setRemarks(note);
				Date date = new Date();
				Calendar calendar = new GregorianCalendar();
				calendar.setTime(date); 
				calendar.add(Calendar.DAY_OF_MONTH, 30);
				date = calendar.getTime();  
				transferCreditQueryHzicbc.setStartDate(startDate);
				transferCreditQueryHzicbc.setEndDate(date);
				
				if(result.equals("001"))
				{
					transferCreditQueryHzicbc.setCreditResult("01");
				}
				else if(result.equals("002"))
				{
					transferCreditQueryHzicbc.setCreditResult("02");
				}
				else if(result.equals("003"))
				{
					transferCreditQueryHzicbc.setCreditResult("03");
				}
				
				transferCreditQueryHzicbc.setCreditQueryStatus(20);
//				transferCreditQueryHzicbc.setCreditResultMark("<p>"+note+"</p>");
//				@update 2018-02-02 查询结果说明 删除<p>便于解析
				transferCreditQueryHzicbc.setCreditResultMark(note);
				transferCreditQueryHzicbc.setOnceCarStatus("-");
			}
			
			//修改结果表
			transferCreditQueryHzicbc.setModified(millis);
			transferCreditQueryHzicbc.setModifierName(loginName);
			int count = transferZxCreditQueryMapper.updateByPrimaryKeySelective(transferCreditQueryHzicbc);
			if(count < 1)
			{
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferZxCreditQueryMapper updateByPrimaryKeySelective error");
			}
			
			if(creditPeopleType.equals("03"))
			{
				TransferZxQueryCreditApply transferZxQueryCreditApply = new TransferZxQueryCreditApply();
				transferZxQueryCreditApply.setId(maps.get("appId"));
				transferZxQueryCreditApply.setQueryCreditApplyStatus(20);
				transferZxQueryCreditApply.setModified(millis);
				transferZxQueryCreditApply.setModifierName(loginName);
				count = rransferZxQueryCreditApplyMapper.updateByPrimaryKeySelective(transferZxQueryCreditApply);
				if(count < 1)
				{
					throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
				}
			}
			
			dataId = maps.get("appId");
		}
		
		TransferLogs transferLogs = new TransferLogs();
		transferLogs.setBankOrderNo(orderno);
		transferLogs.setDataId(dataId);
		transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
		transferLogs.setTransferModeId(TransferModeID.ZXJGHD.getCode());
		transferLogs.setTransferModeName(TransferModeID.ZXJGHD.getValue());
		transferLogs.setStatusEvent(Integer.valueOf(TransferStatusDiepu.STATUSEVENT1.getCode()));
		transferLogs.setDescribeEvent("工行回调中转服务器所处理的征信结果");
		TransferLogsSub transferLogsSub = new TransferLogsSub();
		transferLogsSub.setBankOrderNo(orderno);
		transferLogsSub.setRequestMessageEvent("工行回调中转服务器所处理的征信结果");
		transferLogsSub.setRequestMessageEventEncode(TransferModeID.FKZXJG.getCode());
		transferLogsSub.setResponseMessageEvent("工行回调中转服务器所处理的征信结果成功");
		logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
		hzBiz.loggerInfo("{current module execution success} ... 工行回调中转服务器所处理的征信结果成功");
		return 1;
	}


	@Override
	public int diepuZxQuerySuccessBusiIdUp(SysUserProxy sysUserProxy,TransferZxQueryCreditApply transferZxQueryCreditApply) 
	{
		
		String userId = sysUserProxy.getUserId();
		String loginName = sysUserProxy.getLoginName();
		Integer millis = (int) (System.currentTimeMillis() / 1000);
		
		if(StringUtils.isBlank(userId) || StringUtils.isBlank(loginName))
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent(ResultFlagType.LOGIN_TIMEOUT.getValue());
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError(ResultFlagType.LOGIN_TIMEOUT.getValue());
			throw new BaseException(ResultFlagType.LOGIN_TIMEOUT.getCode().toString(),ResultFlagType.LOGIN_TIMEOUT.getValue());
		}
		
		if(null == transferZxQueryCreditApply)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("transferZxQueryCreditApply is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError(ResultFlagType.PARAM_EMPTY.getValue());
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),ResultFlagType.PARAM_EMPTY.getValue());
		}
		
		if(StringUtils.isBlank(transferZxQueryCreditApply.getBusiId()) || StringUtils.isBlank(transferZxQueryCreditApply.getId()))
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("busiId or id is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError(ResultFlagType.PARAM_EMPTY.getValue());
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),ResultFlagType.PARAM_EMPTY.getValue());
		}
		
		//查询征信主表
		TransferZxQueryCreditApply zxQueryCreditApply = rransferZxQueryCreditApplyMapper.selectByPrimaryKey(transferZxQueryCreditApply.getId());
		if(null == zxQueryCreditApply)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("zxQueryCreditApply is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("zxQueryCreditApply is null");
			throw new BaseException(ResultFlagType.PARAM_EMPTY.getCode().toString(),"zxQueryCreditApply is null");
		}
		
		zxQueryCreditApply.initUpdateData(userId, loginName);
		zxQueryCreditApply.setModified(millis);
		zxQueryCreditApply.setBusiId(transferZxQueryCreditApply.getBusiId());
		int count = rransferZxQueryCreditApplyMapper.updateByPrimaryKeySelective(zxQueryCreditApply);
		if(count < 1)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
		}
		
		TransferYwOrdernoBank transferYwOrdernoBank = new TransferYwOrdernoBank();
		transferYwOrdernoBank.setOrdeRno(zxQueryCreditApply.getBankOrderNo());
		transferYwOrdernoBank.setQueryCreditApplyId(transferZxQueryCreditApply.getId());
		transferYwOrdernoBank.setDpStatus(1);
		transferYwOrdernoBank.setTypeData(3);
		transferYwOrdernoBank = transferYwOrdernoBankMapper.selectRefined(transferYwOrdernoBank);
		if(null == transferYwOrdernoBank)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("transferYwOrdernoBankMapper selectRefined is null");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferYwOrdernoBankMapper selectRefined is null");
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferYwOrdernoBankMapper selectRefined is null");
		}
		
		transferYwOrdernoBank.setBusiId(transferZxQueryCreditApply.getBusiId());
		count = transferYwOrdernoBankMapper.updateByPrimaryKeySelective(transferYwOrdernoBank);
		if(count < 1)
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("transferYwOrdernoBankMapper updateByPrimaryKeySelective error");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferYwOrdernoBankMapper updateByPrimaryKeySelective error");
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferYwOrdernoBankMapper updateByPrimaryKeySelective error");
		}
		
		TransferZxCreditQueryExt transferZxCreditQueryExt = new TransferZxCreditQueryExt();
		transferZxCreditQueryExt.setQueryCreditApplyId(transferZxQueryCreditApply.getId());
		transferZxCreditQueryExt.setDpStatus(1);
		transferZxCreditQueryExt.setTypeData(3);
		List<TransferZxCreditQuery> list = transferZxCreditQueryMapper.selectByExt(transferZxCreditQueryExt);
		if(null == list || 0 == list.size())
		{
			TransferLogs transferLogs = new TransferLogs();
			transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
			transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
			transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
			transferLogs.setDescribeEvent("transferZxCreditQueryMapper selectByExt is null {list.size = 0}");
			logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
			hzBiz.loggerError("transferZxCreditQueryMapper selectByExt is null {list.size = 0}");
			throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferZxCreditQueryMapper selectByExt is null {list.size = 0}");
		}
		
		for(int i=0;i<list.size();i++)
		{
			TransferZxCreditQuery transferZxCreditQuery = list.get(i);
			transferZxCreditQuery.initUpdateData(userId, loginName);
			transferZxCreditQuery.setModified(millis);
			transferZxCreditQuery.setBusiId(transferZxQueryCreditApply.getBusiId());
			count = transferZxCreditQueryMapper.updateByPrimaryKeySelective(transferZxCreditQuery);
			if(count < 1)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
				transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
				transferLogs.setDescribeEvent("transferZxCreditQueryMapper updateByPrimaryKeySelective error");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("transferZxCreditQueryMapper updateByPrimaryKeySelective error");
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferZxCreditQueryMapper updateByPrimaryKeySelective error");
			}
			
			TransferZxQueryCreditApplySub transferZxQueryCreditApplySub = new TransferZxQueryCreditApplySub();
			transferZxQueryCreditApplySub.initUpdateData(userId, loginName);
			transferZxQueryCreditApplySub.setStatusAttachments(StatusAttachments.STATUSATTACHMENTS20.getCode().toString());
			transferZxQueryCreditApplySub.setId(transferZxCreditQuery.getQueryCreditApplySubId());
			count = transferZxQueryCreditApplySubMapper.updateByPrimaryKeySelective(transferZxQueryCreditApplySub);
			if(count < 1)
			{
				TransferLogs transferLogs = new TransferLogs();
				transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
				transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
				transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
				transferLogs.setDescribeEvent("transferZxQueryCreditApplySubMapper updateByPrimaryKeySelective error");
				logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
				hzBiz.loggerError("transferZxQueryCreditApplySubMapper updateByPrimaryKeySelective error");
				throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferZxQueryCreditApplySubMapper updateByPrimaryKeySelective error");
			}
		}
		return 1;
	}


	@Override
	public boolean diepuObtainFileList(SysUserProxy sysUserProxy,String orderno)throws Exception
	{
		
		TransferZxQueryCreditApplyExt transferZxQueryCreditApplyExt = new TransferZxQueryCreditApplyExt();
		transferZxQueryCreditApplyExt.setTransferHandleStatus(TransferHandleStatus.JIE_SHOU_CHENG_GONG.getCode());
		transferZxQueryCreditApplyExt.setDpStatus(1);
		transferZxQueryCreditApplyExt.setTypeData(3);
		transferZxQueryCreditApplyExt.setBankOrderNo(orderno);
		List<TransferZxQueryCreditApply> list = rransferZxQueryCreditApplyMapper.selectByExt(transferZxQueryCreditApplyExt);
		if(null != list && list.size() > 0)
		{
			for(int i=0;i<list.size();i++)
			{
				ObtainFileListRequest obtainFileListRequest = new ObtainFileListRequest();
				obtainFileListRequest.otherAtt = obtainFileListRequest.newOtherAtt();
				obtainFileListRequest.otherAtt.setBankOrderNo(list.get(i).getBankOrderNo());
				obtainFileListRequest.otherAtt.setDataId(list.get(i).getId());
				obtainFileListRequest.otherAtt.setModeId("M_zxcx");
				obtainFileListRequest.otherList.add(obtainFileListRequest.otherAtt);
				ObtainFileListResponse response =  icbcApiService.obtainFileList(obtainFileListRequest);
				if(null == response.getObtainFileLists() || 0 == response.getObtainFileLists().size())
				{
					TransferLogs transferLogs = new TransferLogs();
					transferLogs.setBankOrderNo(list.get(i).getBankOrderNo());
					transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
					transferLogs.setTransferModeId(TransferModeID.HQFJLB.getCode());
					transferLogs.setTransferModeName(TransferModeID.HQFJLB.getValue());
					transferLogs.setDescribeEvent("response.getObtainFileLists {response.getObtainFileLists().size() = 0}");
					logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
					hzBiz.loggerError("response.getObtainFileLists {response.getObtainFileLists().size() = 0}");
					throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"response.getObtainFileLists {response.getObtainFileLists().size() = 0}");
				}
				
				//删除附件
				String sqlXmls = "update transfer_other_attachments set dp_status = 3 where DATAID = '"+list.get(i).getId()+"' and  DP_STATUS = 1";
				hzDao.deleteWhereSqlXmls(sqlXmls);
				
				
				for(int j=0;j<response.getObtainFileLists().size();j++)
				{
					TransferOtherAttachments transferOtherAttachments = new TransferOtherAttachments();
					BeanUtils.copyProperties(response.getObtainFileLists().get(j), transferOtherAttachments);
					transferOtherAttachments.setBankOrderNo(list.get(i).getBankOrderNo());
					transferOtherAttachments.setModeId(TransferModeID.SQCZX.getCode());
					transferOtherAttachments.setTransferAttachStatus(TransferAttachStatus.WEI_XIA_ZAI.getCode());
					int count = transferOtherAttachmentsMapper.insert(transferOtherAttachments);
					if(count < 1)
					{
						TransferLogs transferLogs = new TransferLogs();
						transferLogs.setBankOrderNo(list.get(i).getBankOrderNo());
						transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
						transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
						transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
						transferLogs.setDescribeEvent("transferOtherAttachmentsMapper insert error");
						logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
						hzBiz.loggerError("transferOtherAttachmentsMapper insert error");
						throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"transferOtherAttachmentsMapper insert error");
					}
				}
				
				TransferZxQueryCreditApply transferZxQueryCreditApply = new TransferZxQueryCreditApply();
				transferZxQueryCreditApply.setId(list.get(i).getId());
				transferZxQueryCreditApply.setTransferHandleStatus(20);
				int count = rransferZxQueryCreditApplyMapper.updateByPrimaryKeySelective(transferZxQueryCreditApply);
				if(count < 1)
				{
					TransferLogs transferLogs = new TransferLogs();
					transferLogs.setBankOrderNo(list.get(i).getBankOrderNo());
					transferLogs.setBusiType(ModeIDTypeDiepu.HZICBC.getCode());
					transferLogs.setTransferModeId(TransferModeID.FKZXJG.getCode());
					transferLogs.setTransferModeName(TransferModeID.FKZXJG.getValue());
					transferLogs.setDescribeEvent("rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
					logsBiz.diepuLogs(sysUserProxy, transferLogs, null);
					hzBiz.loggerError("rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
					throw new BaseException(ResultFlagType.FAIL.getCode().toString(),"rransferZxQueryCreditApplyMapper updateByPrimaryKeySelective error");
				}
			}
		}
		return true;
	}
}
